var element;
var layer;

$(document).ready(function () {
    layui.use(['element', 'layer'], function () {
        element = layui.element;
        layer = layui.layer;

        initLoadingAnim();

    });
});




function login() {

    var username = $("#username").val();
    var password = $("#password").val();

    ajax(
        "/login", "POST",
        {
            "username": username,
            "password": password
        },
        true, true, false
    ).done(function (returnData) {
        // 登录成功
        $.cookie("userId", returnData.userId, {expires: 1});
        $.cookie("token", returnData.token, {expires: 1});
        location.href = currentHostUrl + "/views/admin/index.html";
    });

}